import java.io.IOException;
import java.net.*;
import java.util.Arrays;

@SuppressWarnings({"all"})
public class UDPsend {
    public static void main(String[] args) throws IOException, InterruptedException {
        DatagramSocket socket = new DatagramSocket(9998);
        byte[] data = new byte[8192 * 8192] ;
        for (int i = 0; i < 8192 * 8192; i++) {
            data[i] = (byte)i;
        }
        int count = 60000;
        int total = data.length / count + 1;
        System.out.println(data.length);
        while(true){
            for (int i = 0; i < total; i++) {
                byte[] sliceData = Arrays.copyOfRange(data,i * count,(i+1) * count);
                DatagramPacket packet = new DatagramPacket(sliceData, sliceData.length, InetAddress.getByName("127.0.0.1"), 9999);

                socket.send(packet);
            }
//            Thread.sleep(100);
        }
    }
}
